<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>禁止滚动</title>
		<style>
			body {
				height: 3000px;
			}
		</style>
	</head>
	<body>
		<button onclick="hanlerClick()">开启滚动</button>
		<button onclick="hanlerClick2()">禁止滚动</button>

		<script>
			function hanlerClick() {
				document.body.style.overflow = ''
			}

			function hanlerClick2() {
				document.body.style.overflow = 'hidden'
			}
		</script>
	</body>
</html>
